* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: #393d49;
}

.container {
    width: 1000px;
    height: 500px;
}

.container ul {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
}

/* 小图片 */
.container ul li {
    list-style: none;
    width: 200px;
    cursor: pointer;
}

.container ul li img {
    width: 100%;
    /* 加个透明边框，让图片看起来有距离 */
    border: 5px solid transparent;
}

/* 大图片 */
.container ul .bigImg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 400px;
    border: 5px solid transparent;
    background: url("./img/1.jpg") no-repeat;
    background-size: contain;
    /* 设置过渡 */
    transition: all .5s;
}

/* 移动框 */
.container ul .frame {
    position: absolute;
    left: 0;
    bottom: 4px;
    width: 200px;
    height: 80px;
    border: 5px solid salmon;
    /* 解决 bug：悬浮时移动框一直闪烁，这是因为移动框覆盖了图片，通过以下属性便可解决 */
    pointer-events: none;
    /* 设置过渡 */
    transition: all .5s;
}

/* 绘制三角形 */
.container ul .frame::before {
    content: "";
    position: absolute;
    left: calc(50% - 15px);
    top: -18px;
    width: 30px;
    height: 15px;
    background-color: salmon;
    clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

.container ul li:nth-child(1):hover ~ .bigImg {
    background-image: url("./img/1.jpg");
}
.container ul li:nth-child(1):hover ~ .frame {
    left: 0;
}
.container ul li:nth-child(2):hover ~ .bigImg {
    background-image: url("./img/2.jpg");
}
.container ul li:nth-child(2):hover ~ .frame {
    left: 200px;
}
.container ul li:nth-child(3):hover ~ .bigImg {
    background-image: url("./img/3.jpg");
}
.container ul li:nth-child(3):hover ~ .frame {
    left: 400px;
}
.container ul li:nth-child(4):hover ~ .bigImg {
    background-image: url("./img/4.jpg");
}
.container ul li:nth-child(4):hover ~ .frame {
    left: 600px;
}
.container ul li:nth-child(5):hover ~ .bigImg {
    background-image: url("./img/5.jpg");
}
.container ul li:nth-child(5):hover ~ .frame {
    left: 800px;
}
